package com.lingnan.tijian.controller;

import com.lingnan.tijian.domain.Setmeal;
import com.lingnan.tijian.domain.Users;
import com.lingnan.tijian.dto.ApiResponse;
import com.lingnan.tijian.service.ifac.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class SetmealController {
    @Autowired
    SetmealService setmealService;

    /**
     * 给前端用来查询套餐数据列表的接口，数据结构既包括套餐数据列表，还包括每个套餐的检查项数据列表
     */
    @RequestMapping("listSetmealAndCheckItem")
    public ApiResponse listSetmealAndCheckItem(@RequestBody Users user){

        if(user==null||user.getSex()==null){
            user.setSex(1);
        }
        return setmealService.listSetmealAndCheckItem(user.getSex());
    }

    @RequestMapping("getSetmealById")
    public ApiResponse getSetmealById(@RequestBody Setmeal setmeal){


        return setmealService.getSetmealById(setmeal.getSmId());

    }

}
